<template>
  <div>
    <el-menu
      :default-active="activeIndex"
      class="el-menu-demo"
      mode="horizontal"
      :ellipsis="false"
    >
      <div style="margin: auto 5px">
        <el-row>
          <el-col :span="4">
              <img style="width: 40px;" src="../assets/logo.svg">
          </el-col>
          <el-col style="margin: auto 0" :span="20">
            <b style="font-size: 16px">灵动创意工坊成员选拔考试</b>
          </el-col>
        </el-row>
      </div>
      <div class="flex-grow" />
      <div style="margin: auto 20px">
        <el-button class="m-2">王子童 202153060000</el-button>
        <el-button type="warning" icon="Bell"></el-button>
      </div>
      <el-menu-item index="1">用户协议</el-menu-item>
      <el-menu-item index="2">理论题</el-menu-item>
      <el-menu-item index="3">实践题</el-menu-item>
      <div style="margin: auto 20px">
        <el-countdown
          title="距离考试结束还有"
          format="HH 时 mm 分 ss 秒"
          :value="time"
        />
      </div>
      <div style="margin: auto 10px">
        <el-button type="danger" @click="logout">立即交卷</el-button>
      </div>
    </el-menu>
    <div style="padding: 20px">
      <router-view></router-view>
    </div>
  </div>
</template>

<script>
export default {
  name: 'BaseView',
  data(){
    return{
      activeIndex: '1',
      time : (Date.now() + 1000 * 60 * 60 * 24 * 2)
    }
  },
  methods:{
    logout(){
      localStorage.removeItem("token")
      this.$router.push("/login")
    }
  }
}
</script>

<style scoped>
.flex-grow {
  flex-grow: 1;
}
</style>
